home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / schipdmo.doc < prev    next >
Text File  |  1995-03-31  |  3KB  |  113 lines

  1. (Comp.sys.handhelds) 
  2. Item: 3287 by erikmb at etek.chalmers.se 
  3. Author: [Erik Bryntse] 
  4.   Subj: Another demo for S-CHIP (v 1.1) 
  5.   Date: Tue May 28 1991 
  6.  
  7. A SAMPLE PROGRAM FOR S-CHIP v1.1 
  8. ================================ 
  9.  
  10. When I added the extra scroll functions to v1.1, I couldn't resist writing 
  11. a car race. It lets you drive your car on a small forest road in high speed. 
  12. Use 1 and 2 to steer it. Below is the CHIPPER source for this demo and the 
  13. ASCed version. 
  14.  
  15. ; CAR RACE DEMO FOR SUPER-CHIP v 1.1 
  16. ; (and no complaining about the lack of comments, please) 
  17. ; V3, V4 = OLD CAR COORD 
  18. ; V5, V6 = CAR COORDINATES 
  19. ; V7 = ROAD POS 
  20.  
  21.         DB      #00, #FF 
  22.         LD      V5, 60 
  23.         LD      V6, 45 
  24.         LD      V7, 60 
  25.         LD      V3, V5 
  26.         LD      V4, V6 
  27.         LD      I, CAR 
  28.         DRW     V3, V4, 0 
  29.  
  30. MLOOP:  LD      I, CAR 
  31.         DRW     V3, V4, 0 
  32.         DB      #00, #C3 
  33.         DRW     V5, V6, 0 
  34.         SE      VF, 0 
  35.         JP      EXIT 
  36.         LD      V0, V7 
  37.         CALL    PUTROAD 
  38.         LD      V3, V5 
  39.         LD      V4, V6 
  40.         LD      V0, #7 
  41.         SKNP    V0 
  42.         CALL    LEFT 
  43.         LD      V0, #8 
  44.         SKNP    V0 
  45.         CALL    RIGHT 
  46.         RND     V0, 3 
  47.         SNE     V0, 0 
  48.         CALL    RR 
  49.         RND     V0, 3 
  50.         SNE     V0, 0 
  51.         CALL    RL 
  52.         JP      MLOOP 
  53.  
  54. EXIT:   JP      EXIT            ; FINISHED! 
  55.  
  56.  
  57. RIGHT:  ADD     V5, 1 
  58.         SNE     V5, 110 
  59.         LD      V5, 109 
  60.         RET 
  61.  
  62. LEFT:   LD      V0, 1 
  63.         SUB     V5, V0 
  64.         SNE     VF, 0 
  65.         LD      V5, 0 
  66.         RET 
  67.  
  68. RR:     ADD     V7, 1 
  69.         SNE     V7, 90 
  70.         LD      V7, 89 
  71.         RET 
  72.  
  73. RL:     LD      V0, 1 
  74.         SUB     V7, V0 
  75.         SNE     VF, 0 
  76.         LD      V7, 0 
  77.         RET      
  78.  
  79.  
  80. ; PLACE NEW ROAD PART AT COORDINATE V0, 0 
  81. ; IN:   V0 
  82. ; OUT:  - 
  83. ; USES: I, V0, V1 
  84.  
  85. PUTROAD: 
  86.  
  87.         LD      V1, 0 
  88.         LD      I, SROAD 
  89.         DRW     V0, V1, 3 
  90.         ADD     V0, 25 
  91.         DRW     V0, V1, 3 
  92.         RET 
  93.  
  94.  
  95. SROAD:  DB $10100000, $01000000, $10100000 
  96.  
  97. CAR:    DB $00110000, $00001100 
  98.         DB $00111111, $11111100 
  99.         DB $00110010, $01001100 
  100.         DB $00000010, $01000000 
  101.         DB $00000100, $00100000  
  102.         DB $00000100, $00100000 
  103.         DB $00000100, $00100000 
  104.         DB $00000100, $00100000 
  105.         DB $11110100, $00101111 
  106.         DB $11110100, $00101111 
  107.         DB $11111101, $10111111 
  108.         DB $11110110, $01101111 
  109.         DB $11110110, $01101111  
  110.         DB $00000110, $01100000 
  111.         DB $00111111, $11111100 
  112.         DB $01111111, $11111110 
  113.